# Author: Lovy
# File : addProductPage
# Time : 2023-03-21 21:26
from common.basePage import BasePage


class AddProductPage(BasePage):

    def add_product(self, kidx1, kidx2, pname, subtitle, bidx1):
        # 1 点击商品分类
        self.click_element(self.product_kind_select)
        # 2 点击商品分类一级分类
        self.product_kind_select_index1[-1] = self.product_kind_select_index1[-1].format(kidx1)
        self.click_element(self.product_kind_select_index1)
        # 3 点击商品分类二级分类
        self.product_kind_select_index2[-1] = self.product_kind_select_index2[-1].format(kidx2)
        self.click_element(self.product_kind_select_index2)
        # 4 输入商品名称
        self.input_text(self.product_name, pname)
        # 5 输入副标题
        self.input_text(self.product_subtitle, subtitle)
        # 6 点击商品品牌
        self.click_element(self.product_brand_select)
        # 7 点击商品一级分类
        self.product_brand_select_idx[-1] = self.product_brand_select_idx[-1].format(bidx1)
        self.click_element(self.product_brand_select_idx)
        # 8 点击下一步，填写商品促销
        self.click_element(self.next_commodity_promotion_btn)
        # 9 点击下一步，填写商品属性
        self.click_element(self.next_product_attribute_btn)
        # 10 点击下一步，选择商品关联
        self.click_element(self.next_product_related_btn)
        # 11 点击完成，提交商品
        self.click_element(self.complete_btn)
        # 12 点击确定
        self.click_element(self.submit_btn)
